package net.israfil.markup.plugin.swt;

import java.net.URL;

import javax.swing.JComponent;
import javax.swing.JFrame;

import net.israfil.markup.core.ComponentTracker;
import net.israfil.markup.core.JAXBHelper;
import net.israfil.markup.model.Markup;
import net.israfil.markup.plugin.GUI;
import net.israfil.markup.plugin.Plugin;

public class SWTPlugin implements Plugin {

	private ComponentTracker<JFrame, JComponent> components;
	private JAXBHelper jaxbHelper;
	
	public SWTPlugin(ComponentTracker<JFrame, JComponent> components,
					   JAXBHelper jaxbHelper) {
		this.components = components;
		this.jaxbHelper = jaxbHelper;
	}

	public String getToolkit() {
		return "Swing";
	}
	
	public GUI buildGUI(URL definition) {
		Markup markup = jaxbHelper.parse(definition, "net.israfil.markup.plugin.swing");
		return new SWTGUI(components, markup);

	}


}
